home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / c / pcw.zip / FLOAD.C < prev    next >
Text File  |  1990-04-27  |  3KB  |  60 lines

  1. /**********************************************************/
  2. /* File Id.                  Fload.C                      */
  3. /* Author.                   Stan Milam.                  */
  4. /* Date Written.             10/24/89.                    */
  5. /*                                                        */
  6. /*           (c) Copyright 1989-90 by Stan Milam          */
  7. /*                                                        */
  8. /* Comments:  Used to set 43/25 line mode with an EGA and */
  9. /* 50/28/25 line mode with the VGA.  Checks are made to   */
  10. /* ensure that invalid calls (based on video adapter) are */
  11. /* not made.                                              */
  12. /*   Fonts:                                               */
  13. /*      8x8  - 43 line EGA, 50 line VGA                   */
  14. /*      8x14 - 25 line EGA, 28 line VGA                   */
  15. /*      8x16 - 25 line VGA                                */
  16. /* Reference: Programmer's Guide to EGA & VGA by Ferraro. */
  17. /**********************************************************/
  18.  
  19. #include <stdio.h>
  20. #include <dos.h>
  21. #include "pcwproto.h"
  22.  
  23. void fload(int block, int font) {
  24.  
  25.    union REGS regs;
  26.    int   mxr, mxc, tline, bline;
  27.    char  far  *egabyte = (char far *) MK_FP(0,0x487);
  28.    char  egasave;
  29.  
  30.    chk_video_state(&mxr,&mxc);                   /* Make sure we're init */
  31.    if (_adaptor > CGA) {                         /* Must have EGA or VGA */
  32.       get_cursor_size(&tline,&bline);            /* Get the cursor size */
  33.       switch(font) {                             /* Edit the fonts */
  34.          case  8 :
  35.          case 14 :
  36.          case 16 : break;
  37.          default : return;
  38.       }
  39.       if (font == 16) {                          /* Must be VGA for this */
  40.          if (_adaptor == VGA) regs.x.ax = 0x1114;/* So we check it */
  41.          else return;
  42.       }
  43.       else {                                     /* Must be 14 or 8 */
  44.          if (font == 14) regs.x.ax = 0x1111;
  45.          else regs.x.ax = 0x1112;                /* Has to be 8! */
  46.       }
  47.       regs.h.bl = (char) block;                  /* Set the block */
  48.       int86(0x10,®s,®s);                   /* Call BIOS to load font */
  49.       egasave = *egabyte;                        /* Get EGA misc info byte */
  50.       if (font == 8) {                           /* Going to 43 line mode */
  51.          *egabyte = (char) (egasave | 1);        /* Toggle 8x8 emulation */
  52.          set_cursor_size(tline,bline);           /* Set the cursor size */
  53.       }
  54.       else {                                     /* 43/50 to 25 line mode */
  55.          *egabyte = (char) (egasave & 0xfe);     /* Turn 8x8 emulation off */
  56.          set_cursor_size(tline,bline);
  57.       }
  58.    }
  59. }
  60.